package com.qlzb.taskmanagement.controller.timing;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.qlzb.taskmanagement.pojo.OutputWrapper;
import com.qlzb.taskmanagement.service.timingTask.TimingTaskService;
import com.qlzb.taskmanagement.vo.form.TimingTaskFormVo;


/**
 * Created with IntelliJ IDEA.
 *
 * @ClassName timingTaskController
 * @Description TODO    定时任务信息
 * @author ryf
 */

@Controller
@RequestMapping("/timing/timingTask")
public class timingTaskController  {

    @Autowired
    private TimingTaskService timingTaskService;

    @ResponseBody
    @RequestMapping(value = "/addTimingOne",method={RequestMethod.POST})
    public OutputWrapper addTimingOne(TimingTaskFormVo vo) {
        OutputWrapper outputWrapper;
        outputWrapper = timingTaskService.add(vo);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/findTimingById",method={RequestMethod.GET})
    public OutputWrapper findTimingById(@RequestParam("id") String id) {
        OutputWrapper outputWrapper = timingTaskService.findById(id);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/editTimingOne",method={RequestMethod.POST})
    public OutputWrapper editTimingOne(@RequestBody TimingTaskFormVo vo) {
        OutputWrapper outputWrapper = timingTaskService.modify(vo);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/listTimingData",method={RequestMethod.POST})
    public OutputWrapper listTimingData(@RequestParam("id") String id) {
        return timingTaskService.removeById(id);
    }

    @ResponseBody
    @RequestMapping(value = "/listTimingData",method={RequestMethod.GET})
    public OutputWrapper listTimingData(@RequestParam("pageNum") String pageNum,@RequestParam("pageSize") String pageSize){
        OutputWrapper outputWrapper = timingTaskService.findAllAndPageByQueryVo(pageNum,pageSize);
        return outputWrapper;
    }
}
